Conditional Printing
Introduction
When an Argos DataBlock is initially designed, the developer creates a form that the Report Viewer uses to filter or limit the data that will be displayed. There are times when it would be useful to run the same report, but filter the data on information not available on the form.
Consider the following report which lists vendors to which Purchase Orders have been submitted:
For each PO listed, the field “invoice recd” indicates whether an invoice has been received from the vendor, and the field “invoice paid” indicates whether the invoice has been paid. This example uses the Purchase_Orders, Purchase_Order_Items, and Vendors tables from the sample database.
The report is to be modified to list only vendors for which invoices have been received, but not yet paid. Since these fields do not exist within the input selection form, filtering must be done using the “Only print if expression is true” selection within the dialog box that is displayed when editing a band.
Bands used in this report: This report contains a Title Band, Group Header Band, Child Band, Detail Band, and Group Footer Band.
Each record in the Detail Band contains an item within a Purchase Order, but only the total of all items is of interest. The item sum is placed within the Group Footer Band and the Detail Band is not printed. This is why conditional printing is done for the Group Footer Band and not for the Detail Band.
To prohibit printing of the Detail Band, the band height is set to zero in the Options dialog box for the Detail Band.
Conditional printing is done by editing the band that the filtering is to be applied to and entering the condition within the “Only print if expression is true” text box as shown below (for this example filtering is done on the Group Footer Band).
Tip: Conditional Printing can be used for any band type. For Detail Bands, conditional printing is applied to each record within the band, but for other bands it applies to printing or not printing the entire band.
For this band (PO_Footer) an expression was entered to limit the printed information. The complete expression (shown in the following figure) satisfies the condition for printing as described above.
After adding the expression, the report now appears in the figure below with Purchase Orders only printed if invoice received = ‘y’ and invoice paid = ‘n’.
It is necessary to enclose each portion of the expression within parentheses.